
package com.cbwl.eoas.cms.model.sysconfig;

import javax.validation.constraints.NotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.util.StringUtils;

import com.cbwl.eoas.common.base.CommonBean;
import com.cbwl.eoas.common.cache.redis.RedisCache;
import com.cbwl.eoas.common.cache.redis.RedisKeyPrefix;
import com.cbwl.eoas.common.util.SpringContextUtil;


/**
 * 
 * <p>[描述信息：说明类的基本功能]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年10月20日 下午5:26:10
 */
public class SysUserLogDTO extends CommonBean {

	
	private static final long serialVersionUID = -2043138377424181599L;
	private java.lang.Long id;
	@NotNull 
	private java.lang.Long userId;
	@NotNull 
	private String operationType;
	@NotBlank @Length(max=216)
	private java.lang.String newinfo;
	@Length(max=216)
	private java.lang.String oldinfo;
	@NotBlank @Length(max=64)
	private java.lang.String loginIp;
	@Length(max=256)
	private java.lang.String remark;
	
	private java.lang.Long creater;
	
	private java.util.Date gmtCreate;
	
	private String operationTypeName;
	
	public void setId(java.lang.Long value) {
		this.id = value;
	}
	
	public java.lang.Long getId() {
		return this.id;
	}
	
	public void setUserId(java.lang.Long value) {
		this.userId = value;
	}
	
	public java.lang.Long getUserId() {
		return this.userId;
	}
	
	public void setOperationType(String value) {
		this.operationType = value;
		if (!StringUtils.isEmpty(value)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+value);
			if (!StringUtils.isEmpty(redisValue)) {
				this.operationTypeName = redisValue;
			}
		}
	}
	
	public String getOperationType() {
		return this.operationType;
	}
	
	public void setNewinfo(java.lang.String value) {
		this.newinfo = value;
	}
	
	public java.lang.String getNewinfo() {
		return this.newinfo;
	}
	
	public void setOldinfo(java.lang.String value) {
		this.oldinfo = value;
	}
	
	public java.lang.String getOldinfo() {
		return this.oldinfo;
	}
	
	public void setLoginIp(java.lang.String value) {
		this.loginIp = value;
	}
	
	public java.lang.String getLoginIp() {
		return this.loginIp;
	}
	
	public void setRemark(java.lang.String value) {
		this.remark = value;
	}
	
	public java.lang.String getRemark() {
		return this.remark;
	}
	
	public void setCreater(java.lang.Long value) {
		this.creater = value;
	}
	
	public java.lang.Long getCreater() {
		return this.creater;
	}
	
	public void setGmtCreate(java.util.Date value) {
		this.gmtCreate = value;
	}
	
	public java.util.Date getGmtCreate() {
		return this.gmtCreate;
	}
	
	public String getOperationTypeName() {
		return operationTypeName;
	}

	
	public void setOperationTypeName(String operationTypeName) {
		this.operationTypeName = operationTypeName;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("UserId",getUserId())
			.append("OperationType",getOperationType())
			.append("Newinfo",getNewinfo())
			.append("Oldinfo",getOldinfo())
			.append("LoginIp",getLoginIp())
			.append("Remark",getRemark())
			.append("Creater",getCreater())
			.append("GmtCreate",getGmtCreate())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof SysUserLogDTO == false){return false;}
		if(this == obj){return true;}
		SysUserLogDTO other = (SysUserLogDTO)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

